﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CutAways.Geometry;

namespace CutAways.Modeling
{
	[Serializable]
	public struct Vertex
	{
		float x, y, z;

		public static Vertex Empty = new Vertex(0f, 0f, 0f);

		public float X
		{
			get { return x; }
			set { x = value; }
		}

		public float Y
		{
			get { return y; }
			set { y = value; }
		}

		public float Z
		{
			get { return z; }
			set { z = value; }
		}

		public Vertex(float x, float y, float z)
		{
			this.x = x; this.y = y; this.z = z;
		}

		public static bool operator==(Vertex v1, Vertex v2)
		{
			return v1.x == v2.x && v1.y == v2.y && v1.z == v2.z;
		}

		public static bool operator !=(Vertex v1, Vertex v2)
		{
			return !(v1 == v2);
		}

		public override bool Equals(object obj)
		{
			if (!(obj is Vertex))
				return false;
			return this == (Vertex)obj;
		}

		public override int GetHashCode()
		{
			return base.GetHashCode(); // nevim jak
		}

		public static implicit operator Vector(Vertex v)
		{
			return new Vector(v.x, v.y, v.z);
		}
	}
}
